package com.spotify.analysis.controller;

import com.spotify.analysis.dto.Result;
import com.spotify.analysis.service.TrackService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@CrossOrigin(origins = "http://localhost:3000") // 仅此控制器生效
@RestController
@RequestMapping("/keys")
@RequiredArgsConstructor
public class KeyController {
    private final TrackService trackService;

    /**
     * 获取歌曲调式类型列表
     */
    @GetMapping
    public Result<Map<String, Object>> getKeys() {
        Map<String, Object> keys = trackService.getKeys();
        return Result.success(keys);
    }
}